<template>
  <div class="execution">
    <basic-container>
      <div class="msg-title">消息标题：{{$route.query.msgTitle}}</div>
      <avue-crud
        ref="crud"
        :page="page"
        :data="tableData"
        :table-loading="tableLoading"
        :option="tableOption"
        v-model="form"
        @on-load="getList"
        @refresh-change="refreshChange"
        @size-change="sizeChange"
        @current-change="currentChange"
      >
      </avue-crud>
    </basic-container>
  </div>
</template>

<script>
  import {fetchList} from '@/api/message/msgResult'
  import {tableOption} from '@/const/crud/message/msgResult'

  export default {
    name: 'message',
    data() {
      return {
        tableData: [],
        page: {
          total: 0, // 总页数
          currentPage: 1, // 当前页数
          pageSize: 20 // 每页显示多少条
        },
        tableLoading: false,
        tableOption: tableOption,
        form:{}
      }
    },
    created() {

    },
    computed: {
    },
    methods: {
      getList(page, params) {
        this.tableLoading = true
        let msgId = this.$route.query.msgId
        fetchList(msgId,Object.assign({
          descs: 'result.create_time',
          current: page.currentPage,
          size: page.pageSize
        }, params)).then(response => {
          this.tableData = response.data.data.records
          this.page.total = response.data.data.total
          this.tableLoading = false
        }).catch(err => {
          this.tableLoading = false
        })
      },
      handleDetail(id) {
        this.showDraw = true
        this.msgId = id
        // this.$refs.crud.rowEdit(row, index)
      },
      refreshChange() {
        this.getList(this.page)
      },
      sizeChange(pageSize) {
        this.page.pageSize = pageSize
      },
      currentChange(current) {
        this.page.currentPage = current
      },

      updateList(){
        this.getList(this.page)
      },

    }
  }
</script>
<style lang="scss" scoped>
  .msg-title{
    font-size: 16px;
    font-weight: bold;
    margin-left: 10px;
  }
</style>
